function _get(obj, arr, d) {
  const list = arr.replace(/\[(.)\]/g, '.$1').split('.')
  return list.reduce((o, item) => {
    return (o || {})[item]
  }, obj) || d
}
function _get2(obj, arr, d) {
  const list = arr.replace(/\[(.)\]/g, '.$1').split('.')
  let index = 0
  let result = obj
  while (index < list.length && (typeof result === 'object')) {
    result = result[list[index++]]
  }
  return typeof result !== 'undefined' ? result : d
}
const obj = {
  a: [
    {
      b: {
        c: 0
      }
    }
  ]
}
const obj1 = {
  a: {
    b: {
      c: 1
    }
  }
}
// console.log(_get(obj, 'a[1].b.c', 'hi'))
console.log(_get2(obj, 'a[1].b.c', 'hi'))